package net.trustie.webmagic.utils;

import net.trustie.webmagic.one.Configure;
import us.codecraft.webmagic.Site;

//此类用于设置加强爬虫性能
public class Protector {

	//为了防止ip被封，对设置的参数进行随机化
	public static void setRandomArgs(Site site,Configure conf){
		//随机设置UA
		site.setUserAgent(UserAgentPool.getUserAgent());
		//随机设置每次请求的间隔
		int time = MyRandomer.getRandomNum(conf.getMinInterval(),
				conf.getMaxInterval());
		conf.setSleepTimeSpider(time);
		//site.setSleepTime(time);
	}
	
	public void main(String args[]){
		while(true){
			
		}
	}
}
